package com.coolwen.service;

import com.coolwen.dao.GoodsTypeMapper;
import com.coolwen.dao.UserMapper;
import com.coolwen.entity.GoodsType;
import com.coolwen.entity.User;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by user on 2016-11-10.
 */
@Service("goodsTypeService")
public class GoodsTypeServiceImpl implements GoodsTypeService {
    @Autowired
    GoodsTypeMapper goodsTypeMapper;
    //引入log4j,进行日志打印
    private static final Logger LOGGER = Logger.getLogger(GoodsTypeServiceImpl.class);


    @Override
    public GoodsType findByTypeId(Integer typeId) {
        return goodsTypeMapper.selectByPrimaryKey(typeId);
    }

    @Override
    public int deleteGoodsTypeByTypeId(Integer typeId) {
        return goodsTypeMapper.deleteByPrimaryKey(typeId);
    }

    @Override
    public int addGoodsType(GoodsType goodsType) {
        return goodsTypeMapper.insertSelective(goodsType);
    }

    @Override
    public List<GoodsType> findAllGoodsType() {
        return goodsTypeMapper.selectAll();
    }
}
